package ${basePackage}.service.impl;

import ${basePackage}.dao.${modelNameUpperCamel}Mapper;
import ${basePackage}.model.${modelNameUpperCamel};
import ${basePackage}.service.${modelNameUpperCamel}Service;
import ${basePackage}.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * Created by ${author} on ${date}.
 */
@Service
@Transactional
public class ${modelNameUpperCamel}ServiceImpl extends AbstractService<${modelNameUpperCamel}> implements ${modelNameUpperCamel}Service {
    @Resource
    private ${modelNameUpperCamel}Mapper ${modelNameLowerCamel}Mapper;


    @Override
    public List<${modelNameUpperCamel}> get${modelNameUpperCamel}s(Integer page, Integer size) {
    Map map = new HashMap();
    map.put("start", (page - 1) * size);
    map.put("limit", size);
    return ${modelNameLowerCamel}Mapper.get${modelNameUpperCamel}s(map);
    }

    @Override
    public Integer get${modelNameUpperCamel}sCount() {
        return ${modelNameLowerCamel}Mapper.get${modelNameUpperCamel}sCount();
    }


    @Override
    public Integer add${modelNameUpperCamel}(${modelNameUpperCamel} ${modelNameLowerCamel}) {
        return ${modelNameLowerCamel}Mapper.add${modelNameUpperCamel}(${modelNameLowerCamel});
    }

    @Override
    public Integer update${modelNameUpperCamel}(${modelNameUpperCamel} ${modelNameLowerCamel}) {
        return ${modelNameLowerCamel}Mapper.update${modelNameUpperCamel}(${modelNameLowerCamel});
    }

    @Override
    public Integer update${modelNameUpperCamel}Flag(Integer id, Integer flag) {
        Map map = new HashMap();
        map.put("id", id);
        map.put("flag", flag);
        return ${modelNameLowerCamel}Mapper.update${modelNameUpperCamel}Flag(map);
    }


}
